home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / hdf / unix / examples.lha / examples / ris8 / getputim.c next >
Encoding:
C/C++ Source or Header  |  1991-10-03  |  1.0 KB  |  35 lines

  1.  
  2. /*
  3. ** Program to illustrate use of DFR8getdims, DFR8getimage and DFR8addimage
  4. **
  5. ** Files needed:  old.hdf (look in "files" directory)
  6. ** Files created: new.hdf
  7.    The image that is moved from old.hdf to new.hdf contains the spectrum
  8.    of colors, moving from top to bottom, with ten vertical and ten 
  9.    horizontal lines cross-hatched.
  10. */
  11.  
  12. #define HEIGHT 150
  13. #define WIDTH  200
  14. main()
  15. {
  16.     int DFR8getdims(), DFR8getimage(), DFR8putimage();
  17.     int ispal, ret, width, height;
  18.     char image[HEIGHT][WIDTH], pal[768];
  19.  
  20. /************* read in image *****************/
  21.     DFR8getdims("old.hdf", &width, &height, &ispal);
  22.     if (1 /* (width==WIDTH) && (height==150)*/  ) {
  23.        ret = DFR8getimage("old.hdf",image,width,height,pal);
  24.        printf("ret=%d\n",ret);
  25.     } else {
  26.        printf("width=%d   height=%d\n",width, height);
  27.        printf("Wrong dimensions.  Program aborted.");
  28.        exit(1);
  29.     }
  30.  
  31. /****** write same image to different file ***********/
  32.     DFR8addimage("new.hdf", image, width, height, ispal);
  33.  
  34. }
  35.